//
//  XCSMSTextField.m
//  HOLLASMSLoginKit
//
//  Created by Mars on 2019/10/10.
//  Copyright © 2019 mao PengLin. All rights reserved.
//

#import "XCSMSTextField.h"

@implementation XCSMSTextField

- (void)deleteBackward {
    if (self.delegate && [self.delegate respondsToSelector:@selector(textFieldDeleteEvent:)]) {
        [self.deleteDelegate textFieldDeleteEvent:self];
    }
    [super deleteBackward];
}

- (CGRect)caretRectForPosition:(UITextPosition *)position {
    //uncomment to hide cursor
    //return CGRectZero;
    CGRect originalRect = [super caretRectForPosition:position];
    originalRect.origin.y = (self.frame.size.height - 16)/2;
    originalRect.size.height = 16;
    originalRect.size.width = 2;
    
    return originalRect;
}
//禁用长按弹出菜单
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
    UIMenuController *menuController = [UIMenuController sharedMenuController];
    if (menuController) {
        [UIMenuController sharedMenuController].menuVisible = NO;
    }
    return NO;
}

@end
